﻿//************************************************************************************************************
//文件名称(File Name)：PublicMana.cs
//功能描述(Description)：公共功能管理
//数据表(Tables)：
//作者(Author)： zsy
//日期(Create Date)：20130227
//参考文档(Reference)(可选)：
//引用(Using) (可选)﹕
//************************************************************************************************************
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.Sql;
using System.Data.SqlClient;
using DbAdapter.sqldbAdapter;

namespace AnalyseCrmMana
{
    /// <summary>
    /// 下拉列表类
    /// </summary>
    public class DownListInfo
    {
        public int sid
        {
            get;
            set;
        }
        public string selParent
        {
            get;
            set;
        }
        public string selid
        {
            get;
            set;
        }
        public string selValue
        {
            get;
            set;
        }
        public string memo
        {
            get;
            set;
        }

    }

    /// <summary>
    /// 公共方法类
    /// </summary>
    public class PublicMana
    {
        /// <summary>
        /// 获取下拉列表
        /// </summary>
        /// <param name="selp"></param>
        /// <returns></returns>
        public IList<DownListInfo> getSelectByParent(string selp)
        {
            string sql = "select SID,SELParent,SELID,SELVALUE,Memo from tbt_downlist where SELParent = '" + selp + "'";
            ExecuteSql esql = new ExecuteSql();
            DataSet ds = esql.ExecuteDataset(sql);
            List<DownListInfo> downlist = new List<DownListInfo>();
            DownListInfo downinfo;
            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                downinfo = new DownListInfo();
                downinfo.sid = Convert.ToInt32(dr["SID"]);
                downinfo.selParent = dr["SELParent"].ToString();
                downinfo.selid = dr["SELID"].ToString();
                downinfo.selValue = dr["SELVALUE"].ToString();
                downinfo.memo = dr["Memo"].ToString();
                downlist.Add(downinfo);
            }
            return downlist;
        }
    }
}
